package com.xxp.controller;

import com.xxp.common.Result;
import com.xxp.entity.Fuzhou;
import com.xxp.service.FuzhouService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/going_fuzhou")
public class FuzhouController {
    @Autowired
    private FuzhouService fuzhouService;

    @GetMapping("/go")
    public Result select(){
        Fuzhou fz = fuzhouService.select(1);
        fuzhouService.update(fz);
        return Result.success(fz);
    }

    @GetMapping("/all")
    public Result all(){
        return Result.success(fuzhouService.selectAll());
    }

    @GetMapping("/{id}")
    public Result selectById(@PathVariable Integer id){
        return Result.success(fuzhouService.select(id));
    }
    @PutMapping("/update")
    public  Result update(@RequestBody Fuzhou fuzhou){
        fuzhouService.updateAll(fuzhou);
        return Result.success();
    }
}
